using NL.AdreesableAsset;
using System.Collections.Generic;
using UnityEngine;
namespace NL.Advanced
{
    public class CombatSetting_UnitState : MonoBehaviour
    {
        static Dictionary<ObjState, GameObject> ALL = new Dictionary<ObjState, GameObject>();
        public ObjState UnitState;

        [Header("单位状态特效资产URL(配合后缀): EFF_US_ActionNo")]
        public string Url= "EFF_US_";


        protected string _GetUrl(string suffix = "")
        {
            return string.IsNullOrEmpty(suffix) ? Url : $"{Url}_{suffix}";
        }



        public GameObject Mod;
        // Start is called before the first frame update
        void Start()
        {
            if (!ALL.ContainsKey(UnitState))
            {
                AA.LOAD<GameObject>(Url, (w, ob) =>
                {
                  if(ob!=null)  ALL[UnitState] = ob;
                }, gameObject);
            }
        }

        public static GameObject GetEFF(ObjState state)
        {
            var node = ALL.ContainsKey(state) ? ALL[state] : null;
            return node ;
        }

    }
}

